package hjw.com.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 * <p>Project:Academic - Cart
 *
 * @author IvanWei玮 -- maste
 * @version 1.0
 * @DataTime 2025/2/17 15:41
 * @since 1.8
 */
public class Cart {
    private int id;
    private int uid;
    private Book book;
    private int num;
    private double price;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date tcreate;

    public Cart() {
        this.id = 0;
        this.uid = 0;
        this.book = new Book();
        this.num = 0;
        this.price = 0.0;
        this.tcreate = new Date();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public Date getTcreate() {
        return tcreate;
    }

    public void setTcreate(Date tcreate) {
        this.tcreate = tcreate;
    }

    @Override
    public String toString() {
        return "Cart{" +
                "id='" + id + '\'' +
                ", userid='" + uid + '\'' +
                ", book=" + book +
                ", num=" + num +
                ", price=" + price +
                ", date=" + tcreate +
                '}';
    }
}
